﻿///////////////////////////////////////////////////////////////////////
//项目：基于手机蓝牙的可配置的计算机应用程序遥控
//作者：华南理工：曹炼强 林伟彬
//本文件功能：调用蓝牙服务dll
//<注：本项目中的蓝牙发布、传输功能均由另一个工程写成dll供本项目使用>
//////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;

namespace BCC
{
    class Server
    {
        [DllImport("BTServer.dll", EntryPoint = "Advertise", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        //[DllImport("BTServer.dll")]
        public static extern int Advertise(StringBuilder sevName);
        [DllImport("BTServer.dll", EntryPoint = "Send", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int Send(string senStr);
        //[DllImport("BTServer.dll")]
        [DllImport("BTServer.dll", EntryPoint = "Recve", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int Recve(ref string rcvStr,int length);
        [DllImport("BTServer.dll")]
        public static extern int Close();
        [DllImportAttribute("irprops.cpl", EntryPoint = "BluetoothEnableDiscovery", SetLastError = true)]
        [return: MarshalAsAttribute(UnmanagedType.Bool)]
        public static extern bool BluetoothEnableDiscovery(
            IntPtr hRadio,
            [MarshalAsAttribute(UnmanagedType.Bool)] bool fEnabled);
    }
}
